type Action = (...args: any[]) => any;

function emptyAction(): void {
    console.warn('Current execute action is empty!')
}

interface IActions {
    onGlobalStateChange: Action;
    setGlobalState: Action;
}

class Actions implements IActions {
    actions: IActions = {
        onGlobalStateChange: emptyAction,
        setGlobalState: emptyAction,
    }

    setActions(actions: IActions): void {
        this.actions = actions
    }

    onGlobalStateChange(...args: any[]): any {
        return this.actions.onGlobalStateChange(...args)
    }

    setGlobalState(...args: any[]): any {
        return this.actions.setGlobalState(...args)
    }
}

const actions: Actions = new Actions()
export default actions